package com.softeem.work.w6;

public class Auto {
    //轮胎个数
    private int tyreNum;
    //汽车颜色
    private String color;
    //车身重量
    private double weight;
    //速度
    private double speed;

    public Auto() {
    }

    public Auto(int tyreNum, String color, double weight, double speed) {
        this.tyreNum = tyreNum;
        this.color = color;
        this.weight = weight;
        this.speed = speed;
    }

    public int getTyreNum() {
        return tyreNum;
    }

    public void setTyreNum(int tyreNum) {
        this.tyreNum = tyreNum;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    public double getSpeed() {
        return speed;
    }

    public void setSpeed(double speed) {
        this.speed = speed;
    }

    @Override
    public String toString() {
        return "Auto{" +
                "tyreNum=" + tyreNum +
                ", color='" + color + '\'' +
                ", weight=" + weight +
                ", speed=" + speed +
                '}';
    }

    //加速
    public void speedUp() {
        this.speed += 10;
    }
    //减速
    public void speedDown() {
        this.speed -= 10;
    }
    //停车
    public void stop() {
        this.speed = 0;
    }
}
